package com.health.controller;

import com.health.domain.pojo.Checkgroup;
import com.health.domain.query.PageQueryDTO;
import com.health.domain.vo.PageBean;
import com.health.domain.vo.Result;
import com.health.service.CheckgroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author ghy
 * @version 1.0
 * @since 2025-06-22 08:04
 */
@RestController
@RequestMapping("/checkgroup")
public class CheckgroupController {

    @Autowired
    private CheckgroupService checkgroupService;

    /**
     * 分页条件查询
     * @param pageQueryDTO 分页条件
     * @return
     */
    @PostMapping("/findPage")
    public PageBean<Checkgroup> findPage(@RequestBody PageQueryDTO pageQueryDTO) {
        // 处理分页查询
        return checkgroupService.findPage(pageQueryDTO);
    }

    @GetMapping("/findAll")
    public Result<List<Checkgroup>> findAll() {
        return checkgroupService.findAll();
    }

    @GetMapping("/findById")
    public Result<Checkgroup> findById(Integer id) {
           return checkgroupService.findById(id);
    }

    @GetMapping("/findCheckItemIdsByCheckGroupId")
    public Result<List<Integer>> findCheckItemIdsByCheckGroupId(Integer id) {
        return checkgroupService.findCheckItemIdsByCheckGroupId(id);
    }

    @PostMapping("/edit")
    public Result<String> edit(Integer[] checkitemIds, @RequestBody Checkgroup checkgroup) {
        return checkgroupService.edit(checkitemIds, checkgroup);
    }



}
